<template>
  <div class="about">
    <input type="text" v-model="username"/>
    <input type="text" v-model="password"/>
    <button @click="submitClick">提交</button>
  </div>
</template>
<script>
import { mapState } from 'vuex'
import axios from 'axios'
export default {
  data() {
    return {
      username: "",
      password: ""
    }
  },
  computed: {

  },
  mounted() {
   
  },
  methods: {
    submitClick() {
      axios.post('/api/login', {
        username: this.username,
        password: this.password
      }).then(res => {
        console.log(res, 'res')
        if (res.data.code === 0) {
          sessionStorage.setItem('token', res.data.token)
        }
      })
    }
  }
}
</script>
